home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / drdobbs / 1991 / 05 / d_flat / button.c < prev    next >
Text File  |  1991-02-18  |  1KB  |  45 lines

  1. /* -------------- button.c -------------- */
  2.  
  3. #include <conio.h>
  4. #include "dflat.h"
  5.  
  6. int ButtonProc(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
  7. {
  8.     int rtn, i;
  9.     switch (msg)    {
  10.         case SETFOCUS:
  11.             BaseWndProc(BUTTON, wnd, msg, p1, p2);
  12.             if (p1)
  13.                 return TRUE;
  14.         case PAINT:
  15.             if (isVisible(wnd))    {
  16.                 background = WndBackground(GetParent(wnd));
  17.                 foreground = BLACK;
  18.                 PutWindowChar(wnd, WindowWidth(wnd), 0, 220);
  19.                 for (i = 0; i < WindowWidth(wnd); i++)
  20.                     PutWindowChar(wnd, i+1, 1, 223);
  21.                 WriteTextLine(wnd, NULL, 0, wnd == inFocus);
  22.             }
  23.             return TRUE;
  24.         case KEYBOARD:
  25.             if (p1 == '\r')    {
  26.                 PostMessage(GetParent(wnd), COMMAND,
  27.                     ((CTLWINDOW *)(wnd->extension))->command, 0);
  28.                 return TRUE;
  29.             }
  30.             break;
  31.         case LEFT_BUTTON:
  32.             rtn = BaseWndProc(BUTTON, wnd, msg, p1, p2);
  33.             PostMessage(GetParent(wnd), COMMAND,
  34.                 ((CTLWINDOW *)(wnd->extension))->command, 0);
  35.             return rtn;
  36.         case HORIZSCROLL:
  37.             return TRUE;
  38.         default:
  39.             break;
  40.     }
  41.     return BaseWndProc(BUTTON, wnd, msg, p1, p2);
  42. }
  43.  
  44.  
  45.